package common

import "fmt"

// 64位整型
type Long struct {
	RawInt64  int64
	Low32Int  int32
	High32Int int32
}

func NewLong(raw uint64) *Long {
	res := &Long{}
	res.RawInt64 = int64(raw)
	res.Low32Int = int32(res.RawInt64 & 0xFFFFFFFF)
	res.High32Int = int32(res.RawInt64 >> 32)
	return res
}

func (l *Long) GetLow32Uint() uint32 {
	return uint32(l.Low32Int)
}

func (l *Long) String() string {
	return fmt.Sprintf("Long{raw:%d low:%d high:%d}", l.RawInt64, l.Low32Int, l.High32Int)
}
